package com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.view;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.hzdesk.media.matvector.koreabatch.client.my_paperless.R;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.base.BaseActivity;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.contract.IChangeMettingNameContract;
import com.hzdesk.media.matvector.koreabatch.client.my_paperless.logic.persenter.ChangeMettingNamePersenter;

/**
 * Created by Administrator on 2018/8/14.
 * 杭州席媒科技有限公司  Developers  刘传华  10
 * 佛祖镇楼 bug辟易
 */

public class ChangeMettingNameActivity extends BaseActivity implements IChangeMettingNameContract.IChangeMettingNameView {
    private ChangeMettingNamePersenter mChangeMettingNamePersenter = new ChangeMettingNamePersenter(this);
    private TextView tv_name_prompt;
    private EditText et_input_name;
    private int change_name_pager_index;

    @Override
    protected void userAgreedPermissions() {

    }

    @Override
    protected View AddLayoutView() {
        View view = View.inflate(this, R.layout.activity_change_metting_name,null);
        tv_name_prompt = view.findViewById(R.id.activity_change_metting_name_tv_name_prompt);
        et_input_name = view.findViewById(R.id.activity_change_metting_name_et_input_name);
        return view;
    }

    @Override
    protected void initChildViewDate() {
        change_name_pager_index = getIntent().getIntExtra("change_name_pager",0);
        mChangeMettingNamePersenter.initTtile();
    }

    @Override
    protected void onClickedTvRight() {
        mChangeMettingNamePersenter.onClickedSubmit(change_name_pager_index,this);
    }

    @Override
    protected void onClickedIvRight() {

    }

    @Override
    protected void onClickedIvLeft() {
        Intent intent = new Intent();
        intent.putExtra("return_change_name","AlexJepsen");
        setResult(change_name_pager_index,intent);
        finish();
    }

    @Override
    public void showTitle() {
        showTilteBg();
        showTitleContent();
        showTileIvLeft();
        showTilteRightTVContent();
        //设备管理(6)
        if(change_name_pager_index == 2){
            setTitleContent("设置当前会议名", 0xffffffff);
            setTilteRightTVContent("修改",0xffffffff);
        }else{
            setTitleContent("修改名称", 0xffffffff);
            setTilteRightTVContent("提交",0xffffffff);
        }

        setIvLeftIcon(R.mipmap.left_white_return);
        setTitleContentSize(16);
    }

    @Override
    public String getInpitNiName() {
        return et_input_name.getText().toString().trim();
    }

    @SuppressLint("LongLogTag")
    @Override
    public void setReturnName(String name,int index) {
        Intent intent = new Intent();
        intent.putExtra("return_change_name",name);
        setResult(index,intent);
        finish();
    }
}
